<template>
	<view>
		<view class="login">
			<view class="ava">
				<view class="ava-img">
					<image src="../../static/icons/leju-logo.png" mode=""></image>
				</view>
			</view>

		</view>
		<view class="ipts">
			<view class="ipts-t">
				<input type="text" value="" placeholder="用户名/电话" v-model="username" />
			</view>
			<view class="ipts-b">
				<input type="password" value="" placeholder="密码"  v-model="password"/>
			</view>
		</view>
		<view class="login-btn">
			<button type="default" @tap=submit>登录</button>
		</view>
		<view class="footer">
			<view class="footer-l">
				找回密码
			</view>
			<view class="line">
				
			</view>
			<view class="footer-r" @tap="registerNum">
				注册账号
			</view>
		</view>
	</view>
</template>

<script>
	import{login,register} from "../../utils/login/index.js"
	export default {
		data() {
			return {
				username:'18888888888',
				password:"123456"
			}
		},
		methods: {
		submit(){
			login({
				password:this.password,
				username:this.username
			}).then(res=>{
				console.log(res)
				uni.setStorageSync('token',res.data.token)
				uni.showToast({
					title:"登录成功,1秒钟之后自动跳转",
					icon: 'none',
					duration:1000
				})
				 setTimeout(()=>{
				      uni.switchTab({
				      	 url: '/pages/mine/mine',
				      })
				    },1000)
			})
		},
		registerNum(){
			// register({
			// 	// birthday:"1998-10-24",
			// 	  city: "鹤壁",
			// 	  // createTime: "2020-12-27",
			// 	  email: "3136958283@qq.com",
			// 	  growth: 0,
			// 	  historyIntegration: 0,
			// 	  icon: "string",
			// 	  id: "",
			// 	  integration: 0,
			// 	  isDisabled: 0,
			// 	  memberLevelId: "",
			// 	  // modifyTime: "2020-12-27T06:56:57.419Z",
			// 	  nickname: "特朗普",
			// 	  "password": "123456",
			// 	  personalizedSignature: "",
			// 	  phone: "19999999999",
			// 	  realname: "123",
			// 	  sex: 0,
			// 	  sourceType: 0,
			// 	  status: 0,
			// 	  username: "11451422",
			// 	  // wxOpenId: "wx81fb1736b9510344"
				
			// }).then(res=>{
			// 	console.log(res)
				
			// })
			uni.navigateTo({
				url:'/pages/zhuce/zhuce',
			})
		}
		}
	}
</script>

<style scoped lang="scss">
	.login {
		width: 90%;
		margin: 0 auto;
		display: flex;
		justify-content: center;
		align-items: center;
		.ava {
			width: 160rpx;
			height: 160rpx;
			box-shadow: 0rpx 0rpx 60rpx 0px rgba(0, 0, 0, .1);
			border-radius: 50%;
			background-color: #000;
			margin-top: 128rpx;
			margin-bottom: 72rpx;
			margin-left: auto;
			margin-right: auto;
			.ava-img {
				width: 160rpx;
				height: 160rpx;
				border-radius: 50%;
				overflow: hidden;
				image {
					width: 100%;
					height: 100%;
				}
			}
		}

	}

	.ipts {
		width: 90%;
		margin: 0 auto;

		.ipts-t,
		.ipts-b {
			height: 100rpx;
			border: none;
			border-radius: 40rpx;
			box-shadow: 0 0 60rpx 0 rgba(43, 86, 112, .1);
			margin-top: 30rpx;

			input {
				position: relative;
				display: block;
				height: 100%;
				background: none;
				color: inherit;
				opacity: 1;
				font: inherit;
				line-height: inherit;
				letter-spacing: inherit;
				text-align: inherit;
				text-indent: inherit;
				text-transform: inherit;
				text-shadow: inherit;
				width: 80%;
				margin: 0 auto;
			}
		}
	}

	.login-btn {
		width: 90%;
		margin: 0 auto;
		margin-top: 100rpx;

		button {
			width: 100%;
			height: 100rpx;
			background: rgb(53, 78, 68);
			color: rgb(255, 255, 255);
			border-radius: 50rpx;
		}
	}

	.footer {
		width: 90%;
		margin: 0 auto;
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
		font-size: 28rpx;
		margin-top: 64rpx;
		color: rgba(0, 0, 0, .7);
		text-align: center;
		height: 40rpx;
		line-height: 40rpx;
		.line{
			width: 2rpx;
			height: 40rpx;
			background-color: #333333;
			font-size: 24rpx;
			    margin-left: 14rpx;
			    margin-right: 14rpx;
		}
	}
</style>
